#include <stdio.h>
#include <time.h>
#include <stdlib.h>

int main()
{
    /*生成随机数的种子*/
    srand(time(NULL));
    printf("游戏规则;请在0到200猜一个数\n");
    int randonNum = rand() % 200;
    int num=0;
    int max = 200;
    int min = 0;
    printf("randonNum = %d\n", randonNum);

    while (num != randonNum)
    {
        printf("请输入一个%d到%d之间的数\n", min, max);
        scanf("%d", &num);
            if(num < min || num > max)
            {
                printf("error\n");
                break;
            }
            if (num < randonNum)
            {
                printf("小了,%d到%d\n", num, max);
                min = num;
            }
            if (num > randonNum)
            {
                printf("大了,%d到%d\n", min, num);
                max = num;
            }
            if (num == randonNum)
            {
                printf("你猜对了,爆炸了\n");
                break;
            }
    }
    return 0;
}